package com.djx.business.access.repository;

import com.djx.entity.access.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface UserRepository extends JpaRepository<User, String>, JpaSpecificationExecutor<User> {

    //根据姓名字段模糊查询
    @Query(nativeQuery = true, value = "select * from t_user where nick_name like concat('%',?,'%')")
    List<User> findByLikeUsername(String nickName);

    //根据用户名密码查询
    User findByUsernameAndPassword(String username, String password);

    //查询用户名
    User findByUsername(String username);
}
